<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%
    String path = request.getContextPath(); 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+path+ "/"; 

%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>添加老师</title>
	<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/bootstrap-datetimepicker.css" />
    <link rel="stylesheet" href="bootstrap-table/dist/bootstrap-table.css">
    <link rel="stylesheet" type="text/css" href="css/xcConfirm.css" />
	<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />
	<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
	<link rel="stylesheet" href="bootstrap-fileinput-master/css/fileinput.min.css">
	<link href="umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/x-admin.css">
    
    <style type="text/css">
        #panel {
            position: absolute;
            background-color: white;
            max-height: 90%;
            overflow-y: auto;
            top: 10px;
            right: 10px;
            width: 280px;
        }
        .td1{
			float:left;
			width:50px;
			display: block; 
			valign:middle;
		}
		.td2{
			float:left;
			width:200px;
			display: block; 
			valign:middle;
		}
		.td3{
			float:left;
			width:660px;
			display: block; 
			valign:middle;
		}
		.edui-body-container p span {
    		white-space: pre-line!important;
		}
    </style>
</head>
<body>
	<div class="x-body">
            <div   class="form-horizontal" role="form">
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">链接地址:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" disabled="disabled" value="http://www.shituzx.com/terraceHome" />
			    </div>
			  </div>

			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">封面图标:</label>
			    <div class="col-sm-3">
			    	<input id="cover_imageF"  type="file" name="file" multiple class="file-loading">
					<input id="cover_image" value="${result.cover_image}" name="cover_image" type="hidden">
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">封面大标题:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="cover_headline" name="cover_headline" value="${result.cover_headline}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">封面小标题:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="cover_title" name="cover_title" value="${result.cover_title}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">封面简介:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="cover_content" name="cover_content" value="${result.cover_content}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">关于我们标题:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="about_headline" name="about_headline" value="${result.about_headline}" />
			    </div>
			  </div>
			   <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">关于我们图标:</label>
			    <div class="col-sm-3">
			    	<input id="about_imageF"  type="file" name="file" multiple class="file-loading">
					<input id="about_image" value="${result.about_image}" name="about_image" type="hidden">
			    </div>
			  </div>
			   <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">关于我们小图1:</label>
			    <div class="col-sm-3">
			    	<input id="about_img1F"  type="file" name="file" multiple class="file-loading">
					<input id="about_img1" value="${result.about_img1}" name="about_img1" type="hidden">
			    </div>
			  </div>
			   <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">关于我们小图2:</label>
			    <div class="col-sm-3">
			    	<input id="about_img2F"  type="file" name="file" multiple class="file-loading">
					<input id="about_img2" value="${result.about_img2}" name="about_img2" type="hidden">
			    </div>
			  </div>
			   <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">关于我们小图3:</label>
			    <div class="col-sm-3">
			    	<input id="about_img3F"  type="file" name="file" multiple class="file-loading">
					<input id="about_img3" value="${result.about_img3}" name="about_img3" type="hidden">
			    </div>
			  </div>
			   <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">关于我们小图4:</label>
			    <div class="col-sm-3">
			    	<input id="about_img4F"  type="file" name="file" multiple class="file-loading">
					<input id="about_img4" value="${result.about_img4}" name="about_img4" type="hidden">
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">关于我们简介:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="about_content" name="about_content" value="${result.about_content}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名标题:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_headline" name="course_headline" value="${result.course_headline}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名小标题1:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_title1" name="course_title1" value="${result.course_title1}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名简介1:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_content1" name="course_content1" value="${result.course_content1}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名小标题2:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_title2" name="course_title2" value="${result.course_title2}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名简介2:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_content2" name="course_content2" value="${result.course_content2}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名小标题3:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_title3" name="course_title3" value="${result.course_title3}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名简介3:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_content3" name="course_content3" value="${result.course_content3}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名小标题4:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_title4" name="course_title4" value="${result.course_title4}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">课程报名简介3:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="course_content4" name="course_content4" value="${result.course_content4}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">金牌讲师标题:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="teacher_headline" name="teacher_headline" value="${result.teacher_headline}" />
			    </div>
			  </div>
			 <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">金牌讲师图标:</label>
			    <div class="col-sm-3">
			    	<input id="teacher_imageF"  type="file" name="file" multiple class="file-loading">
					<input id="teacher_image" value="${result.teacher_image}" name="teacher_image" type="hidden">
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">金牌讲师名称:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="teacher_name" name="teacher_name" value="${result.teacher_name}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">金牌讲师简介:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="teacher_content" name="teacher_content" value="${result.teacher_content}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">联系地址:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="contact_address" name="contact_address" value="${result.contact_address}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">联系电话:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="contact_phone" name="contact_phone" value="${result.contact_phone}" />
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="firstname" class="col-sm-2 control-label">联系邮箱:</label>
			    <div class="col-sm-3">
			      <input style="width:1200px;" type="text" class="form-control" id="contact_email" name="contact_email" value="${result.contact_email}" />
			    </div>
			  </div>
			  
			  
     	<div class="form-group" style="padding-left: 30%">
        <button type="submit"   onclick="save()"  class="btn btn-info" >保存</button>
   
     </div>
          </div>
	</div>
        <script src="lib/layui/layui.js" charset="utf-8"></script>
        <script src="js/x-layui.js" charset="utf-8"></script>
        <!-- 加载需要的js -->
		<script src="js/jquery-3.2.1.min.js"></script>
		<script src="js/common2.js"></script>
		<script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
		<script src="js/jquery-bootstrap-pagination.js"></script>
		<script src="js/qunit-1.11.0.js"></script>
		<script src="js/bootstrap-datetimepicker.js"></script>
		<script src="js/bootstrap-datetimepicker.zh-CN.js"></script>
	    <script src="js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
	    <script src="bootstrap-fileinput-master/js/fileinput.min.js"></script>
		<script src="bootstrap-fileinput-master/js/locales/zh.js"></script>
		
		<script type="text/javascript" src="umeditor/third-party/template.min.js"></script>
    	<script type="text/javascript" charset="utf-8" src="umeditor/umeditor.config.js"></script>
    	<script type="text/javascript" charset="utf-8" src="umeditor/umeditor.min.js"></script>
    	<script type="text/javascript" src="umeditor/lang/zh-cn/zh-cn.js"></script>
        <script>
            layui.use(['form','layer','upload'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;
              });
            
          //时间插件
    		$('.form_date').datetimepicker({
    	        language:  'zh-CN',
    	        weekStart: 1,
    	        todayBtn:  1,
    			autoclose: 1,
    			todayHighlight: 1,
    			startView: 2,
    			minView: 2,
    			forceParse: 0
    	    });
            $("#cover_imageF").fileinput({
            	 uploadUrl: "upload/photoImg",
     		    uploadAsync: true,
     		    maxFileCount: 1,
     		    initialPreview: [ 
 			    	'<img src="${result.cover_image}"  id="img"  class="file-preview-image"  width="256px" height="160px" />',
 			    	],
    		}).on('fileuploaded', function(event, data, previewId, index) {
    		    var form = data.form, files = data.files, extra = data.extra,
    	        response = data.response, reader = data.reader;
    			if(response.data != null && response.data != ""){
    		    	$("#cover_image").val(response.data);			
    			}else{
    				alert("图片服务器异常，请重新上传！");
    			}
    		});
            $("#about_imageF").fileinput({
            	 uploadUrl: "upload/photoImg",
     		    uploadAsync: true,
     		    maxFileCount: 1,
     		    initialPreview: [ 
 			    	'<img src="${result.about_image}"  id="img"  class="file-preview-image"  width="256px" height="160px" />',
 			    	],
    		}).on('fileuploaded', function(event, data, previewId, index) {
    		    var form = data.form, files = data.files, extra = data.extra,
    	        response = data.response, reader = data.reader;
    			if(response.data != null && response.data != ""){
    		    	$("#about_image").val(response.data);			
    			}else{
    				alert("图片服务器异常，请重新上传！");
    			}
    		});
            $("#about_img1F").fileinput({
            	 uploadUrl: "upload/photoImg",
     		    uploadAsync: true,
     		    maxFileCount: 1,
     		    initialPreview: [ 
 			    	'<img src="${result.about_img1}"  id="img"  class="file-preview-image"  width="256px" height="160px" />',
 			    	],
    		}).on('fileuploaded', function(event, data, previewId, index) {
    		    var form = data.form, files = data.files, extra = data.extra,
    	        response = data.response, reader = data.reader;
    			if(response.data != null && response.data != ""){
    		    	$("#about_img1").val(response.data);			
    			}else{
    				alert("图片服务器异常，请重新上传！");
    			}
    		});
            $("#about_img2F").fileinput({
            	 uploadUrl: "upload/photoImg",
     		    uploadAsync: true,
     		    maxFileCount: 1,
     		    initialPreview: [ 
 			    	'<img src="${result.about_img2}"  id="img"  class="file-preview-image"  width="256px" height="160px" />',
 			    	],
    		}).on('fileuploaded', function(event, data, previewId, index) {
    		    var form = data.form, files = data.files, extra = data.extra,
    	        response = data.response, reader = data.reader;
    			if(response.data != null && response.data != ""){
    		    	$("#about_img2").val(response.data);			
    			}else{
    				alert("图片服务器异常，请重新上传！");
    			}
    		});
            $("#about_img3F").fileinput({
            	 uploadUrl: "upload/photoImg",
     		    uploadAsync: true,
     		    maxFileCount: 1,
     		    initialPreview: [ 
 			    	'<img src="${result.about_img3}"  id="img"  class="file-preview-image"  width="256px" height="160px" />',
 			    	],
    		}).on('fileuploaded', function(event, data, previewId, index) {
    		    var form = data.form, files = data.files, extra = data.extra,
    	        response = data.response, reader = data.reader;
    			if(response.data != null && response.data != ""){
    		    	$("#about_img3").val(response.data);			
    			}else{
    				alert("图片服务器异常，请重新上传！");
    			}
    		});
            $("#about_img4F").fileinput({
            	 uploadUrl: "upload/photoImg",
     		    uploadAsync: true,
     		    maxFileCount: 1,
     		    initialPreview: [ 
 			    	'<img src="${result.about_img4}"  id="img"  class="file-preview-image"  width="256px" height="160px" />',
 			    	],
    		}).on('fileuploaded', function(event, data, previewId, index) {
    		    var form = data.form, files = data.files, extra = data.extra,
    	        response = data.response, reader = data.reader;
    			if(response.data != null && response.data != ""){
    		    	$("#about_img4").val(response.data);			
    			}else{
    				alert("图片服务器异常，请重新上传！");
    			}
    		});
            $("#teacher_imageF").fileinput({
            	 uploadUrl: "upload/photoImg",
     		    uploadAsync: true,
     		    maxFileCount: 1,
     		    initialPreview: [ 
 			    	'<img src="${result.teacher_image}"  id="img"  class="file-preview-image"  width="256px" height="160px" />',
 			    	],
    		}).on('fileuploaded', function(event, data, previewId, index) {
    		    var form = data.form, files = data.files, extra = data.extra,
    	        response = data.response, reader = data.reader;
    			if(response.data != null && response.data != ""){
    		    	$("#teacher_image").val(response.data);			
    			}else{
    				alert("图片服务器异常，请重新上传！");
    			}
    		});
            
            function deleteRow(e)
            {
             e=e||event;
             var btn=e.srcElement||e.target;
             btn.parentNode.parentNode.parentNode.removeChild(btn.parentNode.parentNode);
            }
            
            function divClick(){    
    		    
      	       var show="";    
      	       var apm = document.getElementsByName("hasGroup");    
      	       for(var i=0;i<apm.length;i++){    
      	       if(apm[i].checked)    
      	        show = apm[i].value;    
      	       }    
      	         
      	       switch (show){    
      	           case '0':    
      	               document.getElementById("com").style.display="none";    
      	               break;    
      	           default:    
      	               document.getElementById("com").style.display="block";    
      	               break;                                                       
      	       }    
      	}

             $(function(){
             	
             	var show="";    
       	       var apm = document.getElementsByName("hasGroup");    
       	       for(var i=0;i<apm.length;i++){    
       	       if(apm[i].checked)    
       	        show = apm[i].value;    
       	       }    
       	         
       	       switch (show){    
       	           case '0':    
       	               document.getElementById("com").style.display="none";    
       	               break;    
       	           default:    
       	               document.getElementById("com").style.display="block";    
       	               break;                                                       
       	       }    
             	
             });

            
            function save(){
	   	         $.ajax({
	   	             type: "post",
	   	             url: "platform/updatePlatformActivity",
	   	             data:{
	   	            	cover_image:$("#cover_image").val(),
	   	            	cover_headline:$("#cover_headline").val(),
	   	            	cover_title:$("#cover_title").val(),
	   	            	cover_content:$("#cover_content").val(),
	   	            	about_headline:$("#about_headline").val(),
	   	            	about_image:$("#about_image").val(),
	   	            	about_img1:$("#about_img1").val(),
	   	            	about_img2:$("#about_img2").val(),
	   	            	about_img3:$("#about_img2").val(),
	   	            	about_img2:$("#about_img4").val(),
	   	            	about_content:$("#about_content").val(),
	   	            	course_headline:$("#course_headline").val(),
	   	            	course_title1:$("#course_title1").val(),
	   	            	course_content1:$("#course_content1").val(),
	   	            	course_title2:$("#course_title2").val(),
	   	            	course_content2:$("#course_content2").val(),
	   	            	course_title3:$("#course_title3").val(),
	   	            	course_content3:$("#course_content3").val(),
	   	            	course_title4:$("#course_title4").val(),
	   	            	course_content4:$("#course_content4").val(),
	   	            	teacher_headline:$("#teacher_headline").val(),
	   	            	teacher_image:$("#teacher_image").val(),
	   	            	teacher_name:$("#teacher_name").val(),
	   	            	teacher_content:$("#teacher_content").val(),
	   	            	contact_address:$("#contact_address").val(),
	   	            	contact_phone:$("#contact_phone").val(),
	   	            	contact_phone:$("#contact_phone").val(),
	   	            	contact_email:$("#contact_email").val(),
	   	             },
	   	             dataType:"json",
	   	             success: function(data){    
	   	            	if(data.code == 200){
	   	    	           	layer.alert("修改成功", {icon: 6},function () {
	   	    	           		location.reload();
	   	 	                    /* // 获得frame索引
	   	 	                    var index = parent.layer.getFrameIndex(window.name);
	   	 	                    //关闭当前frame
	   	 	                    parent.layer.close(index);
	   	 	                     parent.location.reload(); */
	   	 	                });    
	   	 	       		}else{
	   	 	    	      	var txt=data.msg;
	   	 	      	    	 layer.alert(txt); 
	   	 	      	    }
	   	             }
	   	         });  
   			}
   	   
   	layui.use(['laydate','element','laypage','layer'], function(){
        $ = layui.jquery;//jquery
      laydate = layui.laydate;//日期插件
      lement = layui.element();//面包导航
      laypage = layui.laypage;//分页
      layer = layui.layer;//弹出层
      
    });
   	
        </script>
</body>
</html>